package com.ljt.yupictureddd.domain.picture.valueobject;

import cn.hutool.core.util.ObjUtil;
import lombok.Getter;

import java.util.Arrays;

@Getter
public enum PictureReviewStatusEnums {
    REVIEWING("待审核",0),
    PASS("通过",1),
    REJECT("拒绝",2);

    private final String text;

    private final int value;

    PictureReviewStatusEnums(String text, int value) {
        this.text = text;
        this.value = value;
    }

    /**
     * 根据value获取枚举
     * @param value
     * @return
     */
    public static PictureReviewStatusEnums getEnumByValue(int value){
        if (ObjUtil.isEmpty(value)){
            return null;
        }
        PictureReviewStatusEnums userRoleEnums = Arrays.stream(PictureReviewStatusEnums.values())
                .filter(u -> u.getValue()==value)
                .findFirst()
                .get();
        return userRoleEnums;
    }
}
